<template>
  <!-- 面包屑项 -->
  <div class="xtx-bread-item">
      <!-- 匿名插槽定义文字 -->
      <router-link v-if="to" :to="to"><slot/></router-link>
      <span v-else><slot/></span>
      <!-- 有传入的就显示传入的 没有传入的就显示默认的字体图标 -->
      <i v-if="separator">{{separator}}</i>
      <i v-else class="iconfont icon-angle-right"></i>
  </div>
</template>
<script>
import { inject } from 'vue'
export default {
  name: 'XtxBreadItem',
  props: {
    to: {
      type: String,
      default: ''
    }
  },
  setup () {
    const separator = inject('separator')
    return { separator }
  }
}
</script>
